﻿-bool allowSavedStates = ViewData.ContainsKey("AllowSavedStates")
-var rmaction = ViewData["Action"]
.padded5
  %input#search{name="search",type="text",value=ViewData["Search"],onkeydown="return dosearch(event)"}
  %a{href="#",onclick="return _search();"} <img src="img/buttons/search.gif" title="Введите искомую строку и нажмите [Enter]" style="vertical-align:top;"/>
%h3.relative Фильтры
  #filtertoolbar
    -bool fa = ViewData.ContainsKey("FilterApplied")
    -bool cc = ViewData.ContainsKey("ColumnsChanged")
    %a.button#showfilter{href="#",onclick="return loadFilter();"}
      =string.Format("<img src=\"img/buttons/filter{0}.gif\" title=\"Фильтр\"/>",fa?"_active":"")
    %a.button#showcolumns{href="#",onclick="return loadColumns();"}
      =string.Format("<img src=\"img/buttons/columns{0}.gif\" title=\"Вид таблицы\"/>",cc?"_active":"")
    %img.divider{src="img/buttons/divider.gif"}
    -if(ViewData.ContainsKey("AllowSavedStates") && ViewData["user"] is User)
      %a#showsavefilter{href="#",onclick="return showSaveState();",class=(fa||cc)?"button":"button disabled"}
        =string.Format("<img src=\"img/buttons/savefilter{0}.gif\" title=\"Сохранить фильтр\"/>",(fa||cc)?"":"_disabled")
    %a#clearfilter{href="#",onclick="return clearFilter()",class=(fa||cc)?"button":"button disabled"} 
      =string.Format("<img src=\"img/buttons/clearfilter{0}.gif\" title=\"Сбросить фильтр\" />",(fa||cc)?"":"_disabled")
    -if(ViewData.ContainsKey("HasExcel"))
      %img.divider{src="img/buttons/divider.gif"}
      %a.button{href="#",onclick="return exportExcel()"} <img src="img/buttons/excel.gif" title="Экспорт в Excel" />
-if( ViewData.ContainsKey("AllowSavedStates") )
  #savefilterholder.popupwrapper{style="display: none;"}
    _table/savefilter
  #savedstates
    _table/savedstates